#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(isdigit(c)){
		x=(x<<1)+(x<<3)+(c^48);
		c=getchar();
	}
	return x*f;
}
const int maxn=1e5+5;
int n;
int a[maxn],t[maxn],bul[maxn];
signed main(){
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
	sort(a+1,a+n+1);
	vector<int>num;
	num.push_back(-1);
	int m=0;
	for(int i=1;i<=n;i++){
		if(t[a[i]]==0)num.push_back(a[i]),m++;
		t[a[i]]++;
	}
	for(int i=1;i<=m;i++)bul[i]=t[num[i]];
	//~ cout<<bul[1]<<" "<<bul[2]<<endl;
	//~ int mn=INT_MAX;
	int cnt=bul[1];
	for(int i=2;i<=m;i++){
		cnt=max(0ll,cnt-bul[i]);
		//~ cout<<cnt<<endl;
		cnt+=bul[i];
		//~ cout<<cnt<<endl;
	}
	printf("%lld\n",ans);
	//1. bul[i]<=n-bul[i] front: bul[i], back: n-bul[i], cha: n-2*bul[i], n-front-cha=n-bul[i]-n+2*bul[i]=bul[i]
	//2. bul[i]>n-bul[i] front:bul[i], back: n-bul[i], cha
	return 0;
}
/*
136 136 136 2417 136 136 2417 136 136 136
136 136 136 136 136 136 136 136 2417 2417
bul[136]=8
bul[2471]=2
11223
bul[1]=2
bul[2]=2
bul[3]=1
4 5
2 1 2 1 1
2
*/
